<%@ Page Title="" MasterPageFile="~/BackOffice.master" Language="C#" AutoEventWireup="true"
    CodeBehind="CadastroPessoa.aspx.cs" Inherits="MakeIT.SGI.ERP.Apresentacao.CadastroPessoa" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    Namespace="System.Web.UI" TagPrefix="asp" %>
<asp:Content ID="cHeadHttpEquiv" ContentPlaceHolderID="headHttpEquiv" runat="server">
</asp:Content>
<asp:Content ID="cHead" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="cCadastro" ContentPlaceHolderID="cphTituloCadastro" runat="server">
    Cadastro de Pessoas (pessoa)
</asp:Content>
<asp:Content ID="cMain" ContentPlaceHolderID="cphMain" runat="server">
    <asp:UpdatePanel ID="upnPessoa" runat="server">
        <ContentTemplate>
            <asp:TabContainer ID="tabPessoa" runat="server" ActiveTabIndex="0">
                <asp:TabPanel ID="tabPesquisa" runat="server" HeaderText="Pesquisa">
                    <ContentTemplate>
                        <div style="width: 100%; background-color: #eeeeff; min-width: 400px; min-height: 300px;">
                            <table border="0" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td valign="middle" style="width: 24px;">
                                        <asp:ImageButton ID="ibPesquisa" runat="server" OnClick="btnPesquisa_Click" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/search.png"
                                            ToolTip="Executa a pesquisa aplicando os filtros" />
                                    </td>
                                    <td valign="middle" align="left">
                                        Filtros:
                                    </td>
                                    <td>
                                        <div class="FormDiv">
                                            <div class="FormLabel">
                                                C&oacute;digo:</div>
                                            <asp:TextBox ID="txtIdPessoa" MaxLength="11" Width="76px" onkeypress="strictNum();"
                                                onblur="validaDecimal(this.value,11,0);" ForeColor="DarkBlue" Font-Bold="True"
                                                runat="server"></asp:TextBox>
                                            <asp:MaskedEditExtender ID="meetxtIdPessoa" runat="server" Mask="99999999999" TargetControlID="txtIdPessoa"
                                                PromptCharacter="" CultureAMPMPlaceholder="" CultureCurrencySymbolPlaceholder=""
                                                CultureDateFormat="" CultureDatePlaceholder="" CultureDecimalPlaceholder="" CultureThousandsPlaceholder=""
                                                CultureTimePlaceholder="" Enabled="True" />
                                        </div>
                                        <div class="FormDiv">
                                            <div class="FormLabel">
                                                Filial:</div>
                                            <asp:DropDownList ID="ddlIdFilial" Width="76px" ForeColor="DarkBlue" Font-Bold="True"
                                                runat="server" DataTextField="Filial" DataValueField="PKString">
                                            </asp:DropDownList>
                                        </div>
                                        <div class="FormDiv">
                                            <div class="FormLabel">
                                                Nome:</div>
                                            <asp:TextBox ID="txtPessoa" MaxLength="60" Width="100px" ForeColor="DarkBlue" Font-Bold="True"
                                                runat="server"></asp:TextBox>
                                        </div>
                                        <div class="FormDiv">
                                            <div class="FormLabel">
                                                Nome&nbsp;Fantasia:</div>
                                            <asp:TextBox ID="txtFantasia" MaxLength="60" Width="100px" ForeColor="DarkBlue" Font-Bold="True"
                                                runat="server"></asp:TextBox>
                                        </div>
                                        <div class="FormDiv">
                                            <div class="FormLabel">
                                                Email:</div>
                                            <asp:TextBox ID="txtEmail" MaxLength="250" Width="100px" ForeColor="DarkBlue" Font-Bold="True"
                                                runat="server"></asp:TextBox>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                            <hr />
                            <asp:GridView ID="grvResultado" runat="server" AutoGenerateColumns="False" EmptyDataText="N&atilde;o foram encontrados registros nessa pesquisa!"
                                CellPadding="1" ForeColor="#333333" AllowPaging="True" PageSize="50" OnPageIndexChanging="grvResultado_PageIndexChanging"
                                EnableModelValidation="True">
                                <Columns>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <asp:ImageButton ID="imgbVisualizar" runat="server" OnClick="imgbVisualizar_Click"
                                                ImageUrl="~/App_Themes/Padrao/imagens/backoffice/editar.gif" CommandArgument='<%#Eval("PKString") %>'
                                                ToolTip="Abrir formulário completo" />
                                        </ItemTemplate>
                                        <ItemStyle HorizontalAlign="Center" />
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="idPessoa" HeaderText="C&oacute;digo" DataFormatString="{0:N0}" />
                                    <asp:BoundField DataField="idFilialVO" HeaderText="Filial" />
                                    <asp:BoundField DataField="pessoa" HeaderText="Nome" />
                                </Columns>
                                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                <EditRowStyle BackColor="#999999" />
                                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                            </asp:GridView>
                        </div>
                    </ContentTemplate>
                </asp:TabPanel>
                <asp:TabPanel ID="tabCadastro" runat="server" HeaderText="Cadastro">
                    <ContentTemplate>
                        <asp:Panel ID="panelCad" runat="server" BackColor="#eeeeee">
                            <div style="width: 100%; min-width: 400px; min-height: 300px;">
                                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td>
                                            <asp:Panel ID="panelBotoes" runat="server">
                                                <asp:Button ID="btnSalvar" runat="server" Enabled="False" ValidationGroup="Salvar"
                                                    OnClick="btnSalvar_Click" Text="Salvar" UseSubmitBehavior="false" />
                                                &nbsp;<asp:Button ID="btnCancelar" runat="server" OnClick="btnCancelar_Click" Text="Cancelar"
                                                    UseSubmitBehavior="false" />
                                                <asp:Button ID="btnEditar" runat="server" Enabled="False" OnClick="btnEditar_Click"
                                                    Text="Editar" UseSubmitBehavior="false" />
                                                &nbsp;<asp:Button ID="btnExcluir" runat="server" Enabled="False" OnClick="btnExcluir_Click"
                                                    Text="Excluir" UseSubmitBehavior="false" />
                                                &nbsp;<asp:Button ID="btnNovo" runat="server" OnClick="btnNovo_Click" Text="Novo"
                                                    UseSubmitBehavior="false" />
                                                <asp:ConfirmButtonExtender ID="ConfirmButtonExtender1" runat="server" TargetControlID="btnExcluir"
                                                    ConfirmText="Confirma a exclus&atilde;o de Pessoas?">
                                                </asp:ConfirmButtonExtender>
                                                <hr />
                                            </asp:Panel>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="FormDiv">
                                                <div class="FormLabel">
                                                    C&oacute;digo:</div>
                                                <asp:TextBox ID="txtCadIdPessoa" MaxLength="11" Width="76" onkeypress="strictNum();"
                                                    onblur="validaDecimal(this.value,11,0);" ForeColor="DarkBlue" Font-Bold="true"
                                                    runat="server"></asp:TextBox>
                                                <asp:MaskedEditExtender ID="meetxtCadIdPessoa" runat="server" Mask="99999999999"
                                                    TargetControlID="txtCadIdPessoa" PromptCharacter="" />
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="FormDiv">
                                                <div class="FormLabel">
                                                    Filial:</div>
                                                <asp:DropDownList ID="ddlCadIdFilial" Width="76" ForeColor="DarkBlue" Font-Bold="true"
                                                    runat="server" DataTextField="Filial" DataValueField="PKString">
                                                </asp:DropDownList>
                                                <asp:HyperLink ID="HyperLinkCadIdFilial" runat="server" NavigateUrl="~/CadastroFilial.aspx"
                                                    ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/editar.gif" Target="CadastroFilial"
                                                    ToolTip="Editar cadastro"></asp:HyperLink>
                                                <asp:ImageButton ID="ImageButtonCadIdFilial" runat="server" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/atualizar.png"
                                                    ToolTip="Atualizar lista" OnClick="atualizarDdlIdFilial" />
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="FormDiv">
                                                <div class="FormLabel">
                                                    Nome:</div>
                                                <asp:TextBox ID="txtCadPessoa" MaxLength="60" Width="350" ForeColor="DarkBlue" Font-Bold="true"
                                                    runat="server"></asp:TextBox>
                                                <asp:RequiredFieldValidator ControlToValidate="txtCadPessoa" ErrorMessage="Preenchimento obrigat&oacute;rio."
                                                    ID="rfvtxtCadPessoa" Display="None" runat="server" ValidationGroup="Salvar"></asp:RequiredFieldValidator>
                                                <asp:ValidatorCalloutExtender ID="vcetxtCadPessoa" runat="server" TargetControlID="rfvtxtCadPessoa">
                                                </asp:ValidatorCalloutExtender>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="FormDiv">
                                                <div class="FormLabel">
                                                    Nome&nbsp;Fantasia:</div>
                                                <asp:TextBox ID="txtCadFantasia" MaxLength="60" Width="350" ForeColor="DarkBlue"
                                                    Font-Bold="true" runat="server"></asp:TextBox>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="FormDiv">
                                                <div class="FormLabel">
                                                    Email:</div>
                                                <asp:TextBox ID="txtCadEmail" MaxLength="250" Width="350" ForeColor="DarkBlue" Font-Bold="true"
                                                    runat="server"></asp:TextBox>
                                                <asp:RegularExpressionValidator ID="revtxtCadEmail" runat="server" ControlToValidate="txtCadEmail"
                                                    ErrorMessage="email incorreto" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                                    ValidationGroup="Salvar" Display="None"></asp:RegularExpressionValidator>
                                                <asp:ValidatorCalloutExtender ID="vcerevtxtCadEmail" runat="server" TargetControlID="revtxtCadEmail">
                                                </asp:ValidatorCalloutExtender>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="FormDiv">
                                                <div class="FormLabel">
                                                    Fone&nbsp;1:</div>
                                                <asp:TextBox ID="txtCadFone1" MaxLength="14" Width="94" onKeyPress="mascaraTelefone();"
                                                    onBlur="validaTelefone();" ForeColor="DarkBlue" Font-Bold="true" runat="server"></asp:TextBox>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="FormDiv">
                                                <div class="FormLabel">
                                                    Fone&nbsp;2:</div>
                                                <asp:TextBox ID="txtCadFone2" MaxLength="14" Width="94" onKeyPress="mascaraTelefone();"
                                                    onBlur="validaTelefone();" ForeColor="DarkBlue" Font-Bold="true" runat="server"></asp:TextBox>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="FormDiv">
                                                <div class="FormLabel">
                                                    Fone&nbsp;3:</div>
                                                <asp:TextBox ID="txtCadFone3" MaxLength="14" Width="94" onKeyPress="mascaraTelefone();"
                                                    onBlur="validaTelefone();" ForeColor="DarkBlue" Font-Bold="true" runat="server"></asp:TextBox>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <hr />
                                            <table border="0" cellpadding="0" cellspacing="3">
                                                <tr>
                                                    <td class="FormLabel">
                                                        Data Cadastro:
                                                    </td>
                                                    <td class="FormLabel">
                                                        Cadastrado por:
                                                    </td>
                                                    <td class="FormLabel">
                                                        Data Edi&ccedil;&atilde;o:
                                                    </td>
                                                    <td class="FormLabel">
                                                        Editado por:
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td class="FormControl">
                                                        <asp:Literal ID="ltDataCadastro" runat="server"></asp:Literal>
                                                    </td>
                                                    <td class="FormControl">
                                                        <asp:Literal ID="ltCadastradoPor" runat="server"></asp:Literal>
                                                    </td>
                                                    <td class="FormControl">
                                                        <asp:Literal ID="ltDataEdicao" runat="server"></asp:Literal>
                                                    </td>
                                                    <td class="FormControl">
                                                        <asp:Literal ID="ltEditadoPor" runat="server"></asp:Literal>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </asp:Panel>
                    </ContentTemplate>
                </asp:TabPanel>
                <asp:TabPanel ID="tabPessoaendereco" runat="server" HeaderText="Endere&ccedil;o&nbsp;de&nbsp;Pessoa">
                    <ContentTemplate>
                        <asp:Panel ID="panelPessoaendereco" runat="server" BackColor="#eeeeee">
                            <div style="width: 100%; min-width: 400px; min-height: 300px;">
                                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td>
                                            <div class="FormLabel">
                                                Pessoas:</div>
                                            <div class="FormControl">
                                                <asp:Literal ID="ltCadPessoaenderecoPessoa" runat="server"></asp:Literal>
                                            </div>
                                            <hr />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:Panel ID="panelCadPessoaenderecoBotoes" runat="server">
                                                <asp:Button ID="btnCadPessoaenderecoSalvar" runat="server" Enabled="False" ValidationGroup="PessoaenderecoSalvar"
                                                    OnClick="btnCadPessoaenderecoSalvar_Click" Text="Salvar" UseSubmitBehavior="false" />
                                                &nbsp;<asp:Button ID="btnCadPessoaenderecoCancelar" runat="server" OnClick="btnCadPessoaenderecoCancelar_Click"
                                                    Text="Cancelar" UseSubmitBehavior="false" />
                                                <asp:Button ID="btnCadPessoaenderecoEditar" runat="server" Enabled="False" OnClick="btnCadPessoaenderecoEditar_Click"
                                                    Text="Editar" UseSubmitBehavior="false" />
                                                &nbsp;<asp:Button ID="btnCadPessoaenderecoExcluir" runat="server" Enabled="False"
                                                    OnClick="btnCadPessoaenderecoExcluir_Click" Text="Excluir" UseSubmitBehavior="false" />
                                                &nbsp;<asp:Button ID="btnCadPessoaenderecoNovo" runat="server" OnClick="btnCadPessoaenderecoNovo_Click"
                                                    Text="Novo" UseSubmitBehavior="false" />
                                                <asp:ConfirmButtonExtender ID="ConfirmButtonExtenderPessoaendereco" runat="server"
                                                    TargetControlID="btnCadPessoaenderecoExcluir" ConfirmText="Confirma a exclus&atilde;o de Endere&ccedil;o&nbsp;de&nbsp;Pessoa?">
                                                </asp:ConfirmButtonExtender>
                                                <hr />
                                            </asp:Panel>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="FormDiv">
                                                <div class="FormLabel">
                                                    C&oacute;digo:</div>
                                                <asp:TextBox ID="txtCadPessoaenderecoIdPessoaEndereco" MaxLength="11" Width="76"
                                                    onkeypress="strictNum();" onblur="validaDecimal(this.value,11,0);" ForeColor="DarkBlue"
                                                    Font-Bold="true" runat="server"></asp:TextBox>
                                                <asp:MaskedEditExtender ID="meetxtCadPessoaenderecoIdPessoaEndereco" runat="server"
                                                    Mask="99999999999" TargetControlID="txtCadPessoaenderecoIdPessoaEndereco" PromptCharacter="" />
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="FormDiv">
                                                <div class="FormLabel">
                                                    Tipo&nbsp;de&nbsp;Endere&ccedil;o:</div>
                                                <asp:DropDownList ID="ddlCadPessoaenderecoIdEnderecoTipo" Width="76" ForeColor="DarkBlue"
                                                    Font-Bold="true" runat="server" DataTextField="EnderecoTipo" DataValueField="PKString">
                                                </asp:DropDownList>
                                                <asp:HyperLink ID="hlCadPessoaenderecoIdEnderecoTipo" runat="server" NavigateUrl="~/CadastroEnderecotipo.aspx"
                                                    ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/editar.gif" Target="CadastroEnderecotipo"
                                                    ToolTip="Editar cadastro"></asp:HyperLink>
                                                <asp:ImageButton ID="ibCadPessoaenderecoIdEnderecoTipo" runat="server" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/atualizar.png"
                                                    ToolTip="Atualizar lista" OnClick="atualizarDdlPessoaenderecoIdEnderecoTipo" />
                                                <asp:RequiredFieldValidator ControlToValidate="ddlCadPessoaenderecoIdEnderecoTipo"
                                                    InitialValue="-1" ErrorMessage="Preenchimento obrigat&oacute;rio." ID="rfvddlCadPessoaenderecoIdEnderecoTipo"
                                                    Display="None" runat="server" ValidationGroup="PessoaenderecoSalvar"></asp:RequiredFieldValidator>
                                                <asp:ValidatorCalloutExtender ID="vceddlCadPessoaenderecoIdEnderecoTipo" runat="server"
                                                    TargetControlID="rfvddlCadPessoaenderecoIdEnderecoTipo">
                                                </asp:ValidatorCalloutExtender>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:CheckBox runat="server" ID="cbEnderecoManual" Text="Inserir endere&ccedil;o manualmente"
                                                AutoPostBack="true" OnCheckedChanged="cbEnderecoManual_checkedChanged" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="FormDiv">
                                                <div class="FormLabel">
                                                    CEP:</div>
                                                <asp:TextBox ID="txtCadPessoaenderecoCEP" MaxLength="9" Width="64" ForeColor="DarkBlue"
                                                    Font-Bold="true" runat="server" ValidationGroup="PessoaenderecoSalvar" onKeyPress="mascaraCep();" ></asp:TextBox>
                                                <asp:RequiredFieldValidator ControlToValidate="txtCadPessoaenderecoCEP" ErrorMessage="Preenchimento obrigat&oacute;rio."
                                                    ID="rfvtxtCadPessoaenderecoCEP" Display="None" runat="server" ValidationGroup="PessoaenderecoSalvar"></asp:RequiredFieldValidator>
                                                <asp:ValidatorCalloutExtender ID="vcetxtCadPessoaenderecoCEP" runat="server" TargetControlID="rfvtxtCadPessoaenderecoCEP">
                                                </asp:ValidatorCalloutExtender>
                                            </div>
                                            <div class="FormDiv">
                                                <asp:ImageButton ID="btnPesquisarEndereco" runat="server" OnClick="btnPesquisarEndereco_Click"
                                                    ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/search.png" ToolTip="Executa a pesquisa aplicando os filtros" />
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="FormDiv">
                                                <div class="FormLabel">
                                                    Estado:</div>
                                                <asp:DropDownList ID="ddlCadEstado" runat="server" AutoPostBack="true" ForeColor="DarkBlue"
                                                    Font-Bold="true" OnSelectedIndexChanged="ddlCadEstado_SelectedIndexChanged" DataTextField="sigla"
                                                    DataValueField="PKString">
                                                </asp:DropDownList>
                                                <asp:RequiredFieldValidator ControlToValidate="ddlCadEstado" InitialValue="-1" ErrorMessage="Preenchimento obrigat&oacute;rio."
                                                    ID="rfvDdlCadEstado" Display="None" runat="server" ValidationGroup="PessoaenderecoSalvar"></asp:RequiredFieldValidator>
                                                <asp:ValidatorCalloutExtender ID="vceDdlCadEstado" runat="server" TargetControlID="rfvDdlCadEstado">
                                                </asp:ValidatorCalloutExtender>
                                                <asp:HyperLink ID="hlEstado" runat="server" NavigateUrl="~/CadastroUf.aspx" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/editar.gif"
                                                    Target="CadastroUf" ToolTip="Editar cadastro"></asp:HyperLink>
                                                <asp:ImageButton ID="btnEstado" runat="server" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/atualizar.png"
                                                    ToolTip="Atualizar lista" OnClick="atualizarDdlidUf" />
                                            </div>
                                            <div class="FormDiv">
                                                <div class="FormLabel">
                                                    Cidade:</div>
                                                <asp:DropDownList ID="ddlCadCidade" runat="server" AutoPostBack="true" ForeColor="DarkBlue"
                                                    Font-Bold="true" OnSelectedIndexChanged="ddlCadCidade_SelectedIndexChanged" DataTextField="cidade"
                                                    DataValueField="PKString">
                                                </asp:DropDownList>
                                                <asp:RequiredFieldValidator ControlToValidate="ddlCadCidade" InitialValue="-1" ErrorMessage="Preenchimento obrigat&oacute;rio."
                                                    ID="rfvDdlCadCidade" Display="None" runat="server" ValidationGroup="PessoaenderecoSalvar"></asp:RequiredFieldValidator>
                                                <asp:ValidatorCalloutExtender ID="vceDdlCadCidade" runat="server" TargetControlID="rfvDdlCadCidade">
                                                </asp:ValidatorCalloutExtender>
                                                <asp:HyperLink ID="hlCidade" runat="server" NavigateUrl="~/CadastroCidade.aspx" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/editar.gif"
                                                    Target="CadastroCidade" ToolTip="Editar cadastro"></asp:HyperLink>
                                                <asp:ImageButton ID="btnCidade" runat="server" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/atualizar.png"
                                                    ToolTip="Atualizar lista" OnClick="atualizarDdlidCidade" />
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                        <asp:Panel runat="server" ID="pnlBairroDDL" >
                                            <div class="FormDiv">
                                                <div class="FormLabel">
                                                    Bairro:</div>
                                                <asp:DropDownList ID="ddlCadBairro" runat="server" AutoPostBack="true" ForeColor="DarkBlue"
                                                    Font-Bold="true" Enabled="false" DataTextField="bairro" DataValueField="PKString"
                                                    OnSelectedIndexChanged="ddlCadBairro_SelectedIndexChanged">
                                                </asp:DropDownList>
                                                <asp:RequiredFieldValidator ControlToValidate="ddlCadBairro" InitialValue="-1" ErrorMessage="Preenchimento obrigat&oacute;rio."
                                                    ID="rfvDdlCadBairro" Display="None" runat="server" ValidationGroup="PessoaenderecoSalvar"></asp:RequiredFieldValidator>
                                                <asp:ValidatorCalloutExtender ID="vceDdlCadBairro" runat="server" TargetControlID="rfvDdlCadBairro">
                                                </asp:ValidatorCalloutExtender>
                                                <asp:HyperLink ID="hlbairro" runat="server" NavigateUrl="~/CadastroBairro.aspx" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/editar.gif"
                                                    Target="CadastroBairro" ToolTip="Editar cadastro"></asp:HyperLink>
                                                <asp:ImageButton ID="btnBairro" runat="server" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/atualizar.png"
                                                    ToolTip="Atualizar lista" OnClick="atualizarDdlidBairro" />
                                            </div>
                                            </asp:Panel>
                                            <asp:Panel runat="server" ID="pnlBairroTXT" Visible="false" Enabled="false">
                                                <div class="FormDiv">
                                                    <div class="FormLabel">
                                                        Bairro:</div>
                                                    <asp:TextBox ID="txtCadPessoaenderecoBairro" MaxLength="80" Width="350" ForeColor="DarkBlue"
                                                        Font-Bold="true" runat="server" ValidationGroup="PessoaenderecoSalvar"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ControlToValidate="txtCadPessoaenderecoBairro" ErrorMessage="Preenchimento obrigat&oacute;rio."
                                                        ID="rfvtxtCadPessoaenderecoBairro" Display="None" runat="server" ValidationGroup="PessoaenderecoSalvar"></asp:RequiredFieldValidator>
                                                    <asp:ValidatorCalloutExtender ID="vcetxtCadPessoaenderecoBairro" runat="server" TargetControlID="rfvtxtCadPessoaenderecoBairro">
                                                    </asp:ValidatorCalloutExtender>
                                                </div>
                                            </asp:Panel>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="FormDiv">
                                                <div class="FormLabel">
                                                    Tipo:</div>
                                                <asp:DropDownList ID="ddlCadIdLogradouroTipo" ForeColor="DarkBlue" Font-Bold="true"
                                                    runat="server" DataTextField="LogradouroSigla" DataValueField="PKString">
                                                </asp:DropDownList>
                                                <asp:RequiredFieldValidator ControlToValidate="ddlCadIdLogradouroTipo" InitialValue="-1"
                                                    ErrorMessage="Preenchimento obrigat&oacute;rio." ID="rfvLogradouroTipo" Display="None"
                                                    runat="server" ValidationGroup="PessoaenderecoSalvar"></asp:RequiredFieldValidator>
                                                <asp:ValidatorCalloutExtender ID="vceLogradouroTipo" runat="server" TargetControlID="rfvLogradouroTipo">
                                                </asp:ValidatorCalloutExtender>
                                                <asp:HyperLink ID="HyperLinkCadIdLogradouroTipo" runat="server" NavigateUrl="~/CadastroLogradouroTipo.aspx"
                                                    ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/editar.gif" Target="CadastroIdLogradouroTipo"
                                                    ToolTip="Editar cadastro"></asp:HyperLink>
                                                <asp:ImageButton ID="ImageButtonCadIdLogradouroTipo" runat="server" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/atualizar.png"
                                                    ToolTip="Atualizar lista" OnClick="atualizarDdlidLogradouroTipo" />
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:Panel runat="server" ID="pnlLogradouroDDL" >
                                                <div class="FormDiv">
                                                    <div class="FormLabel">
                                                        Logradouro:</div>
                                                    <asp:DropDownList ID="ddlCadLogradouro" Width="76" ForeColor="DarkBlue" Font-Bold="true"
                                                        runat="server" DataTextField="Logradouro" DataValueField="PKString" AutoPostBack="true"
                                                        OnSelectedIndexChanged="ddlCadLogradouro_SelectedIndexChanged" ValidationGroup="PessoaenderecoSalvar">
                                                    </asp:DropDownList>
                                                    <asp:RequiredFieldValidator ControlToValidate="ddlCadLogradouro" InitialValue="-1"
                                                        ErrorMessage="Preenchimento obrigat&oacute;rio." ID="rfvDdlCadLogradouro" Display="None"
                                                        runat="server" ValidationGroup="PessoaenderecoSalvar"></asp:RequiredFieldValidator>
                                                    <asp:ValidatorCalloutExtender ID="vceDdlCadLogradouro" runat="server" TargetControlID="rfvDdlCadLogradouro">
                                                    </asp:ValidatorCalloutExtender>
                                                    <asp:HyperLink ID="hlCadPessoaenderecoIdLogradouro" runat="server" NavigateUrl="~/CadastroLogradouro.aspx"
                                                        ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/editar.gif" Target="CadastroLogradouro"
                                                        ToolTip="Editar cadastro"></asp:HyperLink>
                                                    <asp:ImageButton ID="ibCadPessoaenderecoIdLogradouro" runat="server" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/atualizar.png"
                                                        ToolTip="Atualizar lista" OnClick="atulizarDdlidLogradouro " />
                                                </div>
                                            </asp:Panel>
                                            <asp:Panel runat="server" ID="pnlLogradouroTXT" Visible="false" Enabled="false">
                                                <div class="FormDiv">
                                                    <div class="FormLabel">
                                                        Logradouro:</div>
                                                    <asp:TextBox ID="txtCadPessoaenderecoLogradouro" MaxLength="80" Width="350" ForeColor="DarkBlue"
                                                        Font-Bold="true" runat="server" ValidationGroup="PessoaenderecoSalvar"></asp:TextBox>
                                                    <asp:RequiredFieldValidator ControlToValidate="txtCadPessoaenderecoLogradouro" ErrorMessage="Preenchimento obrigat&oacute;rio."
                                                        ID="rfvtxtCadPessoaenderecoLogradouro" Display="None" runat="server" ValidationGroup="PessoaenderecoSalvar"></asp:RequiredFieldValidator>
                                                    <asp:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" TargetControlID="rfvtxtCadPessoaenderecoBairro">
                                                    </asp:ValidatorCalloutExtender>
                                                </div>
                                            </asp:Panel>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="FormDiv">
                                                <div class="FormLabel">
                                                    Numero:</div>
                                                <asp:TextBox ID="txtCadPessoaenderecoNumero" MaxLength="10" Width="70" ForeColor="DarkBlue"
                                                    Font-Bold="true" runat="server" ValidationGroup="PessoaenderecoSalvar"></asp:TextBox>
                                                <asp:RequiredFieldValidator ControlToValidate="txtCadPessoaenderecoNumero" ErrorMessage="Preenchimento obrigat&oacute;rio."
                                                    ID="rfvtxtCadPessoaenderecoNumero" Display="None" runat="server" ValidationGroup="PessoaenderecoSalvar"></asp:RequiredFieldValidator>
                                                <asp:ValidatorCalloutExtender ID="vcetxtCadPessoaenderecoNumero" runat="server" TargetControlID="rfvtxtCadPessoaenderecoNumero">
                                                </asp:ValidatorCalloutExtender>
                                            </div>
                                            <div class="FormDiv">
                                                <div class="FormLabel">
                                                    Complemento:</div>
                                                <asp:TextBox ID="txtCadPessoaenderecoComplemento" MaxLength="20" Width="130" ForeColor="DarkBlue"
                                                    Font-Bold="true" runat="server"></asp:TextBox>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <hr />
                                            <table border="0" cellpadding="0" cellspacing="3">
                                                <tr>
                                                    <td class="FormLabel">
                                                        Data Cadastro:
                                                    </td>
                                                    <td class="FormLabel">
                                                        Cadastrado por:
                                                    </td>
                                                    <td class="FormLabel">
                                                        Data Edi&ccedil;&atilde;o:
                                                    </td>
                                                    <td class="FormLabel">
                                                        Editado por:
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td class="FormControl">
                                                        <asp:Literal ID="ltPessoaenderecoDataCadastro" runat="server"></asp:Literal>
                                                    </td>
                                                    <td class="FormControl">
                                                        <asp:Literal ID="ltPessoaenderecoCadastradoPor" runat="server"></asp:Literal>
                                                    </td>
                                                    <td class="FormControl">
                                                        <asp:Literal ID="ltPessoaenderecoDataEdicao" runat="server"></asp:Literal>
                                                    </td>
                                                    <td class="FormControl">
                                                        <asp:Literal ID="ltPessoaenderecoEditadoPor" runat="server"></asp:Literal>
                                                    </td>
                                                </tr>
                                            </table>
                                        </td>
                                    </tr>
                                </table>
                                <hr />
                                <asp:GridView ID="grvCadPessoaxPessoaendereco" runat="server" AutoGenerateColumns="False"
                                    EmptyDataText="N&atilde;o foram encontrados registros!" CellPadding="1" ForeColor="#333333"
                                    GridLines="Both" RowStyle-ForeColor="#333333" RowStyle-BackColor="#F7F6F3">
                                    <Columns>
                                        <asp:TemplateField>
                                            <ItemTemplate>
                                                <asp:ImageButton ID="imgbVisualizar" runat="server" OnClick="imgbCadPessoaenderecoVisualizar_Click"
                                                    ImageUrl="~/App_Themes/Padrao/imagens/backoffice/editar.gif" CommandArgument='<%#Eval("PKString") %>' />
                                            </ItemTemplate>
                                            <ItemStyle HorizontalAlign="Center" />
                                        </asp:TemplateField>
                                        <asp:BoundField DataField="idPessoaEndereco" HeaderText="C&oacute;digo" DataFormatString="{0:N0}" />
                                        <asp:BoundField DataField="idEnderecoTipoVO" HeaderText="Tipo&nbsp;de&nbsp;Endere&ccedil;o" />
                                        <asp:BoundField DataField="Cadastro" HeaderText="Cadastro" DataFormatString="{0:dd/MM/yyyy HH:mm:ss}" />
                                        <asp:BoundField DataField="CadastradoPor" HeaderText="Nome" />
                                        <asp:BoundField DataField="Edicao" HeaderText="Edi&ccedil;&atilde;o" DataFormatString="{0:dd/MM/yyyy HH:mm:ss}" />
                                        <asp:BoundField DataField="EditadoPor" HeaderText="Nome" />
                                    </Columns>
                                    <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                    <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                    <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                    <EditRowStyle BackColor="#999999" />
                                    <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                </asp:GridView>
                            </div>
                        </asp:Panel>
                    </ContentTemplate>
                </asp:TabPanel>
                <asp:TabPanel ID="tabCadPerfilAdminxPessoa" runat="server" HeaderText="Pessoa&nbsp;X&nbsp;Perfil&nbsp;Administrativo">
                    <ContentTemplate>
                        <asp:Panel ID="panelPerfilAdminxPessoa" runat="server" BackColor="#eeeeee">
                            <div style="width: 100%; min-width: 400px; min-height: 300px;">
                                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td>
                                            <div class="FormLabel">
                                                Pessoa&nbsp;do&nbsp;Sistema:</div>
                                            <div class="FormControl">
                                                <asp:Literal ID="ltCadpanelPerfilAdminxPessoaXPefilAdmin" runat="server"></asp:Literal>
                                            </div>
                                            <hr />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:Panel ID="panelPerfilAdminxPessoaBotoes" runat="server">
                                                <asp:Button ID="btnCadPerfilAdminxPessoaSalvar" runat="server" Enabled="False" ValidationGroup="UsuarioxobjetoSalvar"
                                                    OnClick="btnCadPerfilAdminxPessoaSalvar_Click" Text="Salvar" UseSubmitBehavior="false" />
                                                &nbsp;<asp:Button ID="btnCadPerfilAdminxPessoaCancelar" runat="server" OnClick="btnCadPerfilAdminxPessoaCancelar_Click"
                                                    Text="Cancelar" UseSubmitBehavior="false" />
                                                <asp:Button ID="btnCadPerfilAdminxPessoaEditar" runat="server" Enabled="False" OnClick="btnCadPerfilAdminxPessoaEditar_Click"
                                                    Text="Editar" UseSubmitBehavior="false" />
                                                <hr />
                                            </asp:Panel>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:GridView ID="gvPerfilAdminxPessoas" runat="server" AutoGenerateColumns="False"
                                                EmptyDataText="N&atilde;o foram encontrados registros!" CellPadding="1" ForeColor="#333333"
                                                RowStyle-ForeColor="#333333" RowStyle-BackColor="#F7F6F3" Enabled="false" OnRowDataBound="gvPerfilAdminxPessoas_RowDataBound"
                                                EnableModelValidation="True">
                                                <Columns>
                                                    <asp:TemplateField HeaderText="Pertence" ItemStyle-HorizontalAlign="Center">
                                                        <HeaderTemplate>
                                                            <asp:CheckBox ID="cbPertenceTodos" runat="server" AutoPostBack="True" OnCheckedChanged="cbPertenceTodos_CheckedChanged" />
                                                            &nbsp;<asp:Label ID="Label1" runat="server" Text="Pertence"></asp:Label>
                                                            &nbsp;<asp:ImageButton ID="btnResetPertence" runat="server" ImageUrl="~/App_Themes/Padrao/Imagens/backoffice/reset.png"
                                                                OnClick="btnResetPertence_Click" ToolTip="Desfazer seleções" />
                                                        </HeaderTemplate>
                                                        <ItemTemplate>
                                                            <asp:HiddenField ID="hfIdPerfil" runat="server" Value='<%#Eval("PKString") %>' />
                                                            <asp:CheckBox ID="cbPertence" runat="server" />
                                                        </ItemTemplate>
                                                    </asp:TemplateField>
                                                    <asp:BoundField DataField="perfilAdm" HeaderText="Perfil Administrativo" />
                                                </Columns>
                                                <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                                                <RowStyle BackColor="#F7F6F3" ForeColor="#333333"></RowStyle>
                                                <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                                                <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                                                <EditRowStyle BackColor="#999999" />
                                                <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                                            </asp:GridView>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <hr />
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </asp:Panel>
                    </ContentTemplate>
                </asp:TabPanel>
            </asp:TabContainer>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
